﻿

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="utf-8">
<title>青鸟租房 -发布房屋信息</title>
<link type="text/css" rel="stylesheet" href="css/style.css" />
	<script type="text/javascript" src="js/axios.js"></script>
	<script type="text/javascript" src="js/vue.min.js"></script>
	<script type="text/javascript" src="js/qnzf.js"></script>
<!--	引入样式-->
	<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!--	引入组件库-->
	<script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">
	<myheader></myheader>
	<div id="regLogin" class="wrap">
		<div class="dialog">
			<dl class="clearfix">
				<dd class="past">填写房屋信息</dd>
			</dl>
			<div class="box">
				<form id="House_add_action" name="House_add_action" action="page/House_add.action" method="post">
					<div class="infos">
						<table class="field">
							<tr>
								<td class="field">标 题：</td>
								<td><input type="text" v-model="house.title" value="" id="House_add_action_title" class="text"/></td>
							</tr>
							<tr>
								<td class="field">户 型：</td>
								<td><select class="text" v-model="house.tid" id="houseType"><!-- <option value="1000">一室一厅</option> --></select></td>
							</tr>
							<tr>
								<td class="field">面 积：</td>
								<td><input type="text" v-model="house.floorage" value="" id="House_add_action_floorage" class="text"/></td>
							</tr>
							<tr>
								<td class="field">价 格：</td>
								<td><input type="text" v-model="house.price" value="" id="House_add_action_price" class="text"/></td>
							</tr>

							<tr>
								<td class="field">房产证日期：</td>
								<td>
									<el-date-picker value-format="yyyy/MM/dd"
													v-model="house.pubdate"
													type="date"
													placeholder="选择日期">
									</el-date-picker>
								</td>
<!--								<td><input type="text" class="text" name="pubDate" /></td>-->
							</tr>

							<tr>
								<td class="field">位 置：</td>
								<td>区：<select class="text" v-model="house.tid" id="houseDistrict" onchange="onchangeDistrict(this)"></select>
								街：<select class="text" name="street.id" id="houseStreet"></select>
								</td>
							</tr>
							<tr>
								<td class="field">联系方式：</td>
								<td><input type="text" v-model="house.contact" value="" id="House_add_action_contact" class="text"/></td>
							</tr>
							<tr>
								<td class="field">详细信息：</td>
								<td><textarea v-model="house.description"></textarea></td>
							</tr>
						</table>
						<div class="buttons">
							<input type="submit" @click.prevent="save" id="House_add_action_0" value="立即发布"/>

						</div>
					</div>
				</form>




			</div>
		</div>
	</div>
	<myfooter></myfooter>
</div>
<script>
	var v = new Vue({
		el : "#app",
		data : {
			house : {}
		},
		methods:{
			save(){
				var p = new URLSearchParams();
				for (let name in this.house){
					p.append(name, this.house[name]);
				}
				/**
				 * URLSearchParams
				 * 1. 请求体提交
				 * 2. 格式：a=1&b=2
				 */
				axios.post("/c118s3plyqnzf/house/save",p).then(res=>{
					if (res.data.code){
						alert(res.data.msg);
					} else {
						let errors = res.data.data;
						let msg = errors.map(e=>e.defaultMessage).join("\n");
						alert(msg);
					}
				});
			}
		}
	})
</script>
</body>
</html>